<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
<%@ page import="com.atozsoft.commonutil.Constants"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 
  - Author(s): houfy
  - Date: 2015-01-15 16:12:31
  - Description:
-->
<head>
    <%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
    <%@include file="/coframe/tools/skins/common.jsp" %>
	<title>审批意见</title>
    <%
 	 	//流程实例ID
 	 	String processInstId = "";
		if(request.getParameter("processInstId")!=null){
			processInstId = (String)request.getParameter("processInstId");
		}
		
		String workTypepda = "";
		if(request.getParameter("workType")!=null){
			workTypepda = (String)request.getParameter("workType");
		}
 	%>
</head>
<body>
  	<div id="processApproveOpinionDataGrid" class="nui-datagrid" style="width:100%;height:100%;"
  		 url="com.atozsoft.wf.processOperate.queryProcessApprovalOpinionList.biz.ext" 
  		 idField="approveid" dataField="datas" allowResize="false" allowCellEdit="true" multiSelect="true" showpager="false"
  		 allowCellSelect="true" allowCellValid="true" allowAlternating="true">
    	<div property="columns">
      		<div type="indexcolumn" headerAlign="center">序号</div>
			<div nowrap="nowrap" field="workitemname" width="80px"  headerAlign="center" allowSort="true">流程节点</div> 
			<div nowrap="nowrap" field="approvetype"  width="40px"  align="center" headerAlign="center" allowSort="true" renderer="onApproveType">审批类型</div> 
			<div nowrap="nowrap" field="approvent"    width="200px" align="left"   headerAlign="center" allowSort="true">审批意见</div> 
			<div nowrap="nowrap" field="workhours"    width="40px"  align="center" headerAlign="center" allowSort="true" decimalPlaces="2" dataType="float" name="workhours">工时(H)</div> 
			<!-- <div nowrap="nowrap" field="showatt"      width="60px"  align="center" headerAlign="center" allowSort="true" renderer="showAtt">附件</div>
			<div nowrap="nowrap" field="fileid"       width="60px"  align="center" headerAlign="center" allowSort="true" visible="false"></div> -->
			<div nowrap="nowrap" field="empname"      width="60px"  headerAlign="center" allowSort="true">操作人</div> 
			<div nowrap="nowrap" field="createdate"   width="60px"  align="center" headerAlign="center" allowSort="true" dateFormat="yyyy-MM-dd HH:mm">操作时间</div>
			<!-- <div nowrap="nowrap" field="agent"        width="60px"  align="center" headerAlign="center" allowSort="true" renderer="onApproveAgent">备注</div> -->
			<div field="creater" visible="false">实际审批人id</div>
			<div field="agentto" visible="false">代理人id</div>
			<div field="agentstatus" visible="false">代理状态</div>
			<div field="agentfromname" visible="false">代理发布人</div>
    	</div>
      </div>
	<script type="text/javascript">
     	nui.parse();
    	
    	//grid加载
    	var grid = nui.get("processApproveOpinionDataGrid");
    	var processInstId="<%=processInstId%>";
    	var workTypepda = "<%=workTypepda %>";
        //nui.alert(workTypepda);
        if(workTypepda == "01"){
    		grid.showColumn("workhours");
    	}else{
    		grid.hideColumn("workhours");
    	}
    	
        grid.load({processInstId:processInstId});
        grid.sortBy("createdate","asc");
        
        
        
         //参数类型数据字典关联
		function  onApproveType(e){
		   var dictText="";
		   if (this.field=="approvetype")
		   		dictText = nui.getDictText("PROCESS_APPROVETYPE", e.row.approvetype.trim());
		   return dictText;
		}
		
		 //参数类型数据字典关联
		function  onApproveAgent(e){
		   var dictText="";
		   var userid = e.row.creater;
	   	   var agentto = e.row.agentto;
	   	   var agentstatus = e.row.agentstatus;
	   	   if(agentto!=null && agentto!="" && agentstatus!="" && agentstatus !=null ){
			   if (this.field=="agent"){
			   		if(userid == agentto && agentstatus=="1"){
			   			dictText = "代" + e.row.agentfromname.trim() + "执行审批";
			   		}
			   }
		   }
		   return dictText;
		}
        
        //附件ID
        function showAtt(e){
	        if (this.field=="showatt"){
        		var ids= "";
		        //附件ID赋值
		        //ids=e.row.fileid;
		        ids = "'"+e.row.fileid+"'";
		       
		        if(ids!="'null'"){
		         	return '<a href="#" onclick="onShowPopup(' + ids + ');">附件</a>';
		        }else{
		        	return null;
		        }
        	}
        }
        
        // 打开附件
        /*
        *	ids：附件ID
        */
        function onShowPopup(ids) {
            nui.open({
	            url: "<%=request.getContextPath()%>/wf/popup/process_files.jsp?ids=" + ids,
		        title: "附件",
				width: 410, 
		        height: 200,
		        onload: function () {
                },
                ondestroy: function (action) {
                }
		    });
        }
    </script>
</body>
</html>